package com.atwj.test;

import java.lang.reflect.Method;
import java.util.zip.CheckedOutputStream;

/**
 * @author 吴先森
 * @description:
 * @create 2022-03-22 17:42
 */
public class UserServletTest02 {

    public void login() {
        System.out.println("这是login方法");
    }

    public void regist() {
        System.out.println("这是regist方法");
    }

    public static void main(String[] args) {
        String action = "regist";

        try {
            //获取action业务鉴别字符串，获取相应业务方法反射对象
            Method method = UserServletTest02.class.getDeclaredMethod(action);

            //调用目标业务方法
            method.invoke(new UserServletTest02());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
